Skip to content

Fix error on user deletion with reply #6555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

akatsoulas
Copy link
Collaborator

No description provided.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses an error encountered during user deletion with reply by updating the logic used to check whether a question is considered taken. Key changes include:

  • Revising the is_taken method to include additional conditions for missing or expired tracking fields.
  • Removing assertions in favor of a unified condition that resets the fields and saves the object when necessary.
Comments suppressed due to low confidence (2)

kitsune/questions/models.py:710

  • [nitpick] The method 'is_taken' performs state mutation by resetting the taker fields and calling self.save(), which is not obvious from its name. Consider renaming the method or updating the documentation to clarify its side-effect behavior.
if self.taken_by is None or self.taken_until is None or self.taken_until < datetime.now():

kitsune/questions/models.py:707

  • [nitpick] The updated docstring does not clearly indicate that the method persists changes by calling self.save(). Updating the docstring to explicitly mention this behavior would improve clarity.
If the question is no longer validly taken (due to missing user or expired time), this will reset the database fields and return False.

@akatsoulas akatsoulas merged commit 216d732 into mozilla:main Mar 12, 2025
2 checks passed
@akatsoulas akatsoulas deleted the 500-delete-user-with-reply branch March 12, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants